import { Schema } from 'mongoose';
import { PhotoStatus } from '@/enums/photoEnums';

export const PhotoSchema = new Schema({
  // 图片的宽度
  width: {
    type: Number,
    required: true
  },
  // 图片的高度
  height: {
    type: Number,
    required: true
  },
  // 图片的地址
  url: {
    type: String,
    required: true
  },
  status: {
    type: String,
    enum: Object.values(PhotoStatus),
    default: PhotoStatus.unreviewed
  },
  creator: {
    type: Schema.Types.ObjectId,
    required: true,
    ref: 'users'
  },
  isAvatar: {
    type: Boolean,
    default: false
  }
});